package edu.jmu.action.sysmanage.menu;

import javax.annotation.Resource;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import edu.jmu.action.BaseAction;
import edu.jmu.action.privilege.Permission;
import edu.jmu.bean.system.MenuNode;
import edu.jmu.service.sysmanage.MenuNodeService;

@Controller
@Namespace("/sysmanage")
@Scope(value="prototype")
public class OrderMenuAction extends BaseAction<MenuNode>{
	private static final long serialVersionUID = -6371783214475463598L;
	
	@Resource
	private MenuNodeService menuNodeService;
	private int nodeId;
	private int orginalPosition;
	private int targetPosition;
	
	@Action(value="editNode",results=@Result(
			name=SUCCESS,type="redirectAction",params={
			"actionName", "munuList"
	}))
	@Permission(module="sysmanage",privilege="editNode",desc="修改菜单节点")
	public String editNode(){
		menuNodeService.editMenuNodePosition(nodeId, orginalPosition, targetPosition);
		return SUCCESS;
	}
	

	public void setNodeId(int nodeId) {
		this.nodeId = nodeId;
	}

	public void setOrginalPosition(int orginalPosition) {
		this.orginalPosition = orginalPosition;
	}

	public void setTargetPosition(int targetPosition) {
		this.targetPosition = targetPosition;
	}	
}
